home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1997 January: Mac OS SDK / Dev.CD Jan 97 SDK2.toast / Development Kits (Disc 2) / OpenDoc Development Framework / ODFDev / ODF / OS / FWGraphx / FWPolySh.h < prev    next >
Encoding:
Text File  |  1996-09-17  |  3.7 KB  |  134 lines  |  [TEXT/MPS ]

  1. //========================================================================================
  2. //
  3. //    File:                FWPolySh.h
  4. //    Release Version:    $ ODF 2 $
  5. //
  6. //    Copyright:    (c) 1993 - 1996 by Apple Computer, Inc., all rights reserved.
  7. //
  8. //========================================================================================
  9.  
  10. #ifndef FWPOLYSH_H
  11. #define FWPOLYSH_H
  12.  
  13. #ifndef FWSHAPE_H
  14. #include "FWShape.h"
  15. #endif
  16.  
  17. #ifndef FWRECT_H
  18. #include "FWRect.h"
  19. #endif
  20.  
  21. #ifndef FWPOLY_H
  22. #include "FWPoly.h"
  23. #endif
  24.  
  25. #ifndef FWGCONST_H
  26. #include "FWGConst.h"
  27. #endif
  28.  
  29. //========================================================================================
  30. //    Forward Declarations
  31. //========================================================================================
  32.  
  33. class FW_CGraphicContext;
  34.  
  35. //========================================================================================
  36. //    class FW_CPolygonShape
  37. //========================================================================================
  38.  
  39. class FW_CPolygonShape : public FW_CShape
  40. {
  41. public:
  42.     FW_DECLARE_CLASS
  43.     FW_DECLARE_AUTO(FW_CPolygonShape)
  44.  
  45. //---------------------------------------------------------------------------------------
  46. //    Constructors/Destructors
  47. //
  48. public:
  49.     FW_CPolygonShape(const FW_CPolygon& polygon,
  50.                      FW_ERenderVerbs renderVerb,
  51.                      FW_Boolean autoCloseFrame,
  52.                      const FW_CInk& ink = FW_kNormalInk,
  53.                      const FW_CStyle& style = FW_kNormalStyle);
  54.  
  55.     FW_CPolygonShape(const FW_CPolygonShape& other);
  56.     FW_CPolygonShape(FW_CReadableStream& stream);
  57.     
  58.     virtual ~FW_CPolygonShape();
  59.  
  60. //----------------------------------------------------------------------------------------
  61. //    Operators
  62. //
  63. public:
  64.     FW_CPolygonShape& operator=(const FW_CPolygonShape& other);
  65.  
  66. //---------------------------------------------------------------------------------------
  67. //    New API
  68. //
  69. public:
  70.     void                    SetAutoCloseFrame(FW_Boolean autoCloseFrame);
  71.     FW_Boolean                GetAutoCloseFrame() const;
  72.  
  73. //---------------------------------------------------------------------------------------
  74. //    Inherited API
  75. //
  76. public:
  77.     // ----- Rendering -----
  78.     virtual void            Render(FW_CGraphicContext& gc) const;
  79.  
  80.     // ----- Hit Testing -----
  81.     virtual FW_Boolean         HitTest(FW_CGraphicContext& gc,
  82.                                     const FW_CPoint& test,
  83.                                     FW_Fixed tolerance) const;
  84.     
  85.     // ----- Copying -----
  86.     virtual FW_CShape*        Copy() const;
  87.     
  88.     // ----- Transform -----
  89.     virtual void            Transform(Environment *ev, ODTransform* transform);
  90.     virtual void            InverseTransform(Environment *ev, ODTransform* transform);
  91.  
  92.     virtual void            MoveShape(FW_Fixed deltaX, FW_Fixed deltaY);
  93.     virtual void            MoveShapeTo(FW_Fixed x, FW_Fixed y);
  94.  
  95.     virtual void            Inset(FW_Fixed x, FW_Fixed y);
  96.     
  97.     // ----- Geometry -----
  98.     virtual void             GetBounds(FW_CGraphicContext& gc, FW_CRect& rect) const;
  99.  
  100.     // ----- Anchor Point -----
  101.     virtual FW_CPoint        GetAnchorPoint() const;
  102.     
  103.     // ----- Flatten -----
  104.     virtual void            Flatten(FW_CWritableStream& stream) const;
  105.     
  106. //---------------------------------------------------------------------------------------
  107. //    New API
  108. //
  109. public:
  110.     // ----- Rendering -----
  111.     static void        RenderPolygon(FW_CGraphicContext& gc,
  112.                                     const FW_CPolygon& polygon,
  113.                                   FW_ERenderVerbs renderVerb,
  114.                                   FW_Boolean autoCloseFrame,
  115.                                     const FW_CInk& ink = FW_kNormalInk,
  116.                                     const FW_CStyle& style = FW_kNormalStyle);
  117.  
  118.     // ----- Archiving -----
  119.     static void*     Read(FW_CReadableStream& stream, FW_ClassTypeConstant type);
  120.  
  121.     // ----- Geometry -----
  122.     void            GetGeometry(FW_CPolygon& polygon) const;
  123.     void            SetGeometry(const FW_CPolygon& polygon);
  124.  
  125. //---------------------------------------------------------------------------------------
  126. //    Data Members
  127. //
  128. private:
  129.     FW_CPolygon fPolygon;
  130.     FW_Boolean fAutoCloseFrame;
  131. };
  132.  
  133. #endif // FWPOLYSH_H
  134.